{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5afa7b49",
   "metadata": {},
   "source": [
    "## 本周学习内容"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "69d302d5",
   "metadata": {},
   "source": [
    "### jupyter notebook键盘快捷键"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d1df05d7",
   "metadata": {},
   "source": [
    "#### 进入命令模式后"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bc1a86ce",
   "metadata": {},
   "source": [
    "* A在活跃单元之上插入一个新的单元，B在之下插入一个新的单元格。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9c136294",
   "metadata": {},
   "source": [
    "* 连续按两次D，可以删除一个单元。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8f60906a",
   "metadata": {},
   "source": [
    "* 按z，撤销被删除的单元。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "12f6a03e",
   "metadata": {},
   "source": [
    "* Y会将当前活跃的单元格变成代码单元，M会将其变成Markdown形式。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "653b60c2",
   "metadata": {},
   "source": [
    "* shift+上或下箭头可选择多个单元。在多选模式时，shift+M可合并你的选择。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "03f172c8",
   "metadata": {},
   "source": [
    "* 按F会弹出【查找/替换】菜单。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b5d0bf90",
   "metadata": {},
   "source": [
    "### 处于编辑模式时（在命令模式时按ENTER会进入编辑模式）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "44dac73f",
   "metadata": {},
   "source": [
    "* Ctrl+S保存进度"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3efc2932",
   "metadata": {},
   "source": [
    "* Ctrl+enter会运行整个单元块"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a6ab1d3",
   "metadata": {},
   "source": [
    "* Alt+enter 会运行当前单元块，还会在下面添加一个新单元。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "33fcd848",
   "metadata": {},
   "source": [
    "* Ctrl+shift+F打开命令面板。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "224267d2",
   "metadata": {},
   "source": [
    "* Ctrl+Home 到达单元起始位置。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6074614",
   "metadata": {},
   "source": [
    "### 数字 int、float、complex"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "221ed3de",
   "metadata": {},
   "source": [
    "### 常见模块使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cc2703c1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用模块\n",
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e1f50ac8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2021, 10, 5)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# datetime 里面的 date 方法\n",
    "datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4ae6169e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# datetime 里面的 date 方法 取出年月日\n",
    "datetime.date.today().day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "dd49dcca",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.date.today().month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "93722bc2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2021"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.date.today().year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "90f2f43d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2021, 10, 5, 15, 16, 6, 200816)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# datetime 里面的 datetime 的方法 可以取出年月日时分秒毫秒微秒\n",
    "datetime.datetime.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e6e1f030",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2021-10-05'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# datetime 中 isoformat 格式化年月日\n",
    "datetime.date.isoformat(datetime.date.today())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "03067880",
   "metadata": {},
   "source": [
    "* datetime. 点击TAB键可查看所有模块的所有方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "21cdf892",
   "metadata": {},
   "source": [
    "* help（）括号中写模块，可了解模块的使用方法。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a65db8ed",
   "metadata": {},
   "source": [
    "### 字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "56fd935e",
   "metadata": {},
   "source": [
    "* i-item为变量i是简称是临时变量，5代表执行代码5次（5）为（0，5）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d46ff91d",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6aba04c4",
   "metadata": {},
   "source": [
    "* 两个数字为起始数字，终止数字，相减为输出值的个数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "35e53136",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(0,5))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "79ce57a6",
   "metadata": {},
   "source": [
    "* 输出值为在0-10的范围内[0，0+3，0+3+3，...]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e5df3bcb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 3, 6, 9]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(0,10,3))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0186486",
   "metadata": {},
   "source": [
    "* 输出值为在0--100的范围内[-10，-10-30，-10-30-30，...]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6833bf81",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[-10, -40, -70]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(-10,-100,-30))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfe233a3",
   "metadata": {},
   "source": [
    "### random 随机"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "669871fa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "7b9756fa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.8574473864805034"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 随机生成数字\n",
    "random.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "ef7ae821",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(0,3)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
